import { useState } from 'react'
import './App.css'

function App() {
  const [count, setCount] = useState(20)
  const [name,setName] = useState('张三')

  const handleName = () =>{
    setName('李四')
  }
  const handleAdd = () =>{
    setCount(count+1)
  }
  const handlejian = () =>{
    setCount(count-1)
  }
  return (
    <div>
      <h1>名字: {name} </h1>
      <button onClick={()=>handleName()}>更改名字</button>
      <h1>年龄: {count} 岁</h1>
      <button onClick={()=>handleAdd()}>年龄 + 1</button>
      <button onClick={()=>handlejian()}>年龄 - 1</button>
    </div>
  )
}

export default App
